package com.ryskoo.common.constant;

/**
 * 优惠券常量类
 * @author BeHappy
 */
public class CouponConstant {

    /**
     * 优惠券类别
     */
    public static enum CouponTypeEnum {
        ALL(1, "全场通用券"),
        CATEGORY(2, "分类券"),
        BRAND(3, "品牌券"),
        PRODUCT(4, "单品券");
        private int value;
        private String name;

        CouponTypeEnum(int value, String name) {
            this.value = value;
            this.name = name;
        }

        public int getValue() {
            return value;
        }

        public void setValue(int value) {
            this.value = value;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public static String getNameByValue(int value) {
            for (CouponTypeEnum o : CouponTypeEnum.values()) {
                if (o.getValue() == value) {
                    return o.getName();
                }
            }
            return "";
        }
    }

    /**
     * 优惠券状态
     */
    public static enum CouponStateEnum {
        UNSTART(1, "未开始"),
        DOING(2, "进行中"),
        END(3, "已结束");
        private int value;
        private String name;

        CouponStateEnum(int value, String name) {
            this.value = value;
            this.name = name;
        }

        public int getValue() {
            return value;
        }

        public void setValue(int value) {
            this.value = value;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public static String getNameByValue(int value) {
            for (CouponStateEnum o : CouponStateEnum.values()) {
                if (o.getValue() == value) {
                    return o.getName();
                }
            }
            return "";
        }
    }

    /**
     * 优惠券明细状态
     */
    public static enum UseStateEnum {
        UNUSED(1, "未使用"),
        USED(2, "已使用"),
        OUT_OF_DATE(3, "已过期");
        private int value;
        private String name;

        UseStateEnum(int value, String name) {
            this.value = value;
            this.name = name;
        }

        public int getValue() {
            return value;
        }

        public void setValue(int value) {
            this.value = value;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public static String getNameByValue(int value) {
            for (UseStateEnum o : UseStateEnum.values()) {
                if (o.getValue() == value) {
                    return o.getName();
                }
            }
            return "";
        }
    }

    /**
     * 优惠券适用终端
     */
    public static enum CouponClientEnum {
        ALL("1", "通用"),
        PC("2", "PC"),
        APP("3", "APP"),
        MINIPROGRAM("4", "小程序"),
        H5("5", "H5");
        private String value;
        private String name;

        CouponClientEnum(String value, String name) {
            this.value = value;
            this.name = name;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public static String getNameByValue(String value) {
            for (CouponClientEnum o : CouponClientEnum.values()) {
                if (o.getValue().equals(value)) {
                    return o.getName();
                }
            }
            return "";
        }
    }

    /**
     * 获取方式
     */
    public static enum ObtainTypeEnum {
        ONLINE(1, "线上领取"),
        OFFLINE(2, "线下发放");
        private int value;
        private String name;

        ObtainTypeEnum(int value, String name) {
            this.value = value;
            this.name = name;
        }

        public int getValue() {
            return value;
        }

        public void setValue(int value) {
            this.value = value;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public static String getNameByValue(int value) {
            for (ObtainTypeEnum o : ObtainTypeEnum.values()) {
                if (o.getValue() == value) {
                    return o.getName();
                }
            }
            return "";
        }
    }

}
